<template>
  <div>
    <el-table
      :data="tableData"
      style="width: 100%; margin-bottom: 20px"
      row-key="id"
      border
      :default-expand-all="false"
      :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
    >
      <el-table-column prop="name" label="区域名称" width="">
        <template slot-scope="scope">
          <span>{{ scope.row.name }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="type" label="区域类型" width="">
        <template slot-scope="scope">
          <span v-if="scope.row.type == 1">省</span>
          <span v-if="scope.row.type == 2">市</span>
          <span v-if="scope.row.type == 3">区</span>
        </template>
      </el-table-column>
      <el-table-column prop="code" label="区域编码"> </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tableData: [],
    };
  },
  methods: {
    getTableData() {
      let data = {
      };
      this.$store
        .dispatch("shopping/district_getTableData", data)
        .then((res) => {
          // console.log(res, "res");
          this.tableData = res.data.list;
        });
    },
  },
  created() {
    this.getTableData();
  },
};
</script>

<style>
</style>